/*
 * @Description: 系统通知详情   DetailsSystemNotification
 * @version: 
 * @Company: 
 * @Author: ZhengZhuang
 * @Date: 2019-08-27 09:37:05
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2019-11-15 10:00:41
 */
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:C20Driver/config/service_api.dart';
import 'package:C20Driver/model/get_msg_content.dart';
import 'package:C20Driver/service/service_method.dart';
import 'package:C20Driver/widget/appbar_widget.dart';
import 'package:C20Driver/widget/spinkit.dart';

class DetailsSystemNotification extends StatelessWidget {
  final String id;
  final String headTitle;
  DetailsSystemNotification({this.id, this.headTitle});

  Future<void> getMsgContent() async {
    return await DioUtils().request(ReqMethod.POST, ServiceApi.getMsgContent,
        params: {'id': id}, success: (res) async {
      return res;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppbarWidget(headTitle),
      body: FutureBuilder(
        future: getMsgContent(),
        builder: (BuildContext context, AsyncSnapshot snapshot) {
          if (snapshot.hasData) {
            var getMsgContentData = GetMsgContent.fromJson(snapshot.data);
            return ListView(
              children: <Widget>[
                SizedBox(
                  height: ScreenUtil().setWidth(30.0),
                ),
                Center(
                  child: Text(
                    getMsgContentData.createTime,
                    style: TextStyle(
                      fontSize: ScreenUtil().setSp(30.0),
                      color: Color.fromARGB(255, 153, 153, 153),
                    ),
                  ),
                ),
                Container(
                  padding: EdgeInsets.all(ScreenUtil().setWidth(30.0)),
                  child: Text(
                    getMsgContentData.content,
                    style: TextStyle(
                      fontSize: ScreenUtil().setSp(30.0),
                    ),
                  ),
                ),
              ],
            );
          } else {
            return Spinkit();
          }
        },
      ),
    );
  }
}
